Skip to content

Conversation

dnerini
Copy link
Contributor

@dnerini dnerini commented Sep 29, 2025

Description

This PR adds support for running the interpolator on:

  • (GRIB) files from a forecaster model.
  • test files from the anemoi-datasets (interpolation of analysis)
  • fix input creation which was broken by the recent refactoring changes
  • set inference date adequately for interpolator models
  • refactored pre-processors to operate at the state level
  • added an extract mask pre processor for cases where emulator is run with trim_edge

Related to #345
Close #310

What issue or task does this change relate to?

N/A

Additional notes

This draft includes all the changes introduced by @OpheliaMiralles in anemoi-inference in order to run interpolation. We should have a discussion on what changes should be factored out in a separate PR.

As a contributor to the Anemoi framework, please ensure that your changes include unit tests, updates to any affected dependencies and documentation, and have been tested in a parallel setting (i.e., with multiple GPUs). As a reviewer, you are also responsible for verifying these aspects and requesting changes if they are not adequately addressed. For guidelines about those please refer to https://anemoi.readthedocs.io/en/latest/

By opening this pull request, I affirm that all authors agree to the Contributor License Agreement.

@github-project-automation github-project-automation bot moved this to To be triaged in Anemoi-dev Sep 29, 2025
@github-actions github-actions bot added dependencies Pull requests that update a dependency file config labels Sep 29, 2025
@dnerini dnerini requested a review from frazane September 29, 2025 08:41
@dnerini dnerini changed the title Add support for interpolator from files feat: Add support for interpolator from files Sep 29, 2025
@dnerini dnerini requested a review from Copilot September 29, 2025 11:01
Copy link

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR adds support for running the interpolator on GRIB files from forecaster models, enabling interpolation on file-based inputs rather than just analysis data.

Key changes:

  • Added support for interpolation from GRIB files with different reference date handling
  • Enhanced pre-processors to work with State objects instead of just FieldList objects

Reviewed Changes

Copilot reviewed 12 out of 12 changed files in this pull request and generated 5 comments.

Show a summary per file
File Description
src/anemoi/inference/runners/interpolator.py Added file-based interpolation support and device management
src/anemoi/inference/runners/default.py Added distributed process group cleanup and reference date handling
src/anemoi/inference/runner.py Enhanced with distributed computing, improved tensor operations, and better device handling
src/anemoi/inference/pre_processors/no_missing_values.py Updated to process State objects instead of FieldList
src/anemoi/inference/pre_processors/forward_transform_filter.py Updated to process State objects instead of FieldList
src/anemoi/inference/pre_processors/extract.py New processor for extracting subsets of data using masks or slices
src/anemoi/inference/inputs/gribfile.py Added support for reference date index parameter
src/anemoi/inference/inputs/ekd.py Enhanced state creation with reference date support and improved pre-processing
src/anemoi/inference/inputs/cutout.py Added kwargs support for input state creation
src/anemoi/inference/device.py Enhanced device selection with distributed computing support
src/anemoi/inference/config/init.py Relaxed configuration validation to allow extra fields
pyproject.toml Updated omegaconf version constraint

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

@gmertes
Copy link
Member

gmertes commented Sep 30, 2025

Thanks for this! As you say, I think we first need to discuss how to bring this functionality into the codebase. I think this would be a good topic for in two weeks when Harrison and I are in Zurich ?

Copy link
Member

@gmertes gmertes left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Very nice, thanks for the hard work on this!

Copy link
Member

@HCookie HCookie left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, thanks for addressing all the concerns we raised.

@HCookie HCookie merged commit 1418990 into main Oct 15, 2025
71 checks passed
@HCookie HCookie deleted the fix/interp_files branch October 15, 2025 15:31
@github-project-automation github-project-automation bot moved this from Under Review to Done in Anemoi-dev Oct 15, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ATS Approval not needed bug Something isn't working config dependencies Pull requests that update a dependency file enhancement New feature or request

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

Uninformative assertion error

5 participants